package 栈;

public class copystack {
    public static void main(String[] args) throws Exception {
    seqStack s1 = new seqStack();
        s1.push('a');
        s1.push('b');
        s1.push('c');
    seqStack s2 = new seqStack();

        copy(s1,s2);
        s2.print();
    }

    public static void copy(seqStack s1, seqStack s2) throws Exception {
        Object[]a =new Object[s1.size()];
        for (int i = 0; i <=s1.size()+1; i++) {
            a[i]=s1.pop();
        }
        for (int i = a.length-1 ;i>=0 ; i--) {
            s2.push(a[i]);
        }

    }
}
